home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 2004 #9
/
Amiga Plus CD - 2004 - No. 09.iso
/
amigaplus
/
tools
/
amigaos4_only
/
ifxlite
/
imagefx3
/
rexx
/
changefps.ifx
< prev
next >
Wrap
Text File
|
2004-08-03
|
3KB
|
127 lines
/*
* $VER: ChangeFPS 2.0.0 (22.7.94)
*
* Arexx program for the ImageFX image processing system.
* Written by Thomas Krehbiel
*
* Takes a series of numbered frames that were captured at a given
* frame rate, and converts them to output frames translated to
* an alternate frame rate.
*
*/
OPTIONS RESULTS
sourcepath = GETCLIP('Changefps_SourcePath')
sourcefile = GETCLIP('Changefps_SourceFile')
destpath = GETCLIP('Changefps_DestPath')
destfile = GETCLIP('Changefps_DestFile')
sourcefps = GETCLIP('Changefps_Sourcefps')
destfps = GETCLIP('Changefps_Destfps')
digits = GETCLIP('Changefps_Digits')
IF sourcepath = "" THEN DO
GetPrefs LoadPath
sourcepath = result
END
IF destpath = "" THEN DO
GetPrefs SavePath
destpath = result
END
IF sourcefps = "" THEN sourcefps = 30
IF destfps = "" THEN destfps = 15
IF digits = "" THEN digits = 5
Gadget.1 = 'STRING 200 5 200 14 "Source Frames Base:"' sourcepath||sourcefile
Gadget.2 = 'FILEREQ 401 5 20 14 "Source Base:"' sourcepath '#?' sourcefile
Gadget.3 = 'STRING 200 20 200 14 "Destination Frames Base:"' destpath||destfile
Gadget.4 = 'FILEREQ 401 20 20 14 "Destination Base:" ' destpath '#?' destfile
Gadget.5 = 'INTEGER 200 40 50 14 "Source Frame Rate (FPS):"' sourcefps
Gadget.6 = 'INTEGER 200 55 50 14 "Dest Frame Rate (FPS):"' destfps
Gadget.7 = 'INTEGER 200 72 50 14 "Digits In Extensions:"' digits
Gadget.8 = 'END'
NewComplexRequest '"Change Frame Rate"' Gadget 430 94
IF rc ~= 0 THEN EXIT
sourcepath = result.2.path
sourcefile = result.2.file
sourcebase = result.1
destpath = result.4.path
destfile = result.4.file
destbase = result.3
sourcefps = result.5
destfps = result.6
digits = result.7
SETCLIP('Changefps_SourcePath', sourcepath)
SETCLIP('Changefps_SourceFile', sourcefile)
SETCLIP('Changefps_DestPath', destpath)
SETCLIP('Changefps_DestFile', destfile)
SETCLIP('Changefps_Sourcefps', sourcefps)
SETCLIP('Changefps_Destfps', destfps)
SETCLIP('Changefps_Digits', digits)
IF destfps = sourcefps THEN DO
RequestNotify '"Frame rates must be different."'
EXIT
END
IF destfps > sourcefps THEN DO
/*
* Increasing the frame rate. This means we need toss out frames.
*/
factor = destfps / sourcefps
sourceframe = 1.0
destframe = 1
DO FOREVER
realframe = TRUNC(sourceframe+0.5)
Message sourceframe realframe
LoadBuffer sourcebase||RIGHT('00000'||realframe,digits)
IF rc ~= 0 THEN LEAVE
SaveBufferAs ILBM destbase||RIGHT('00000'||destframe,digits)
sourceframe = sourceframe + factor
destframe = destframe + 1
END
END
ELSE DO
/*
* Decreasing the frame rate. This means we need to add frames.
*/
factor = destfps / sourcefps
sourceframe = 1.0
destframe = 1
DO FOREVER
realframe = TRUNC(sourceframe+0.5)
Message sourceframe realframe
LoadBuffer sourcebase||RIGHT('00000'||realframe,digits)
IF rc ~= 0 THEN LEAVE
SaveBufferAs ILBM destbase||RIGHT('00000'||destframe,digits)
sourceframe = sourceframe + factor
destframe = destframe + 1
END
END
EXIT